
package jpoco.client;

import java.util.*;

import com.google.gson.annotations.SerializedName;

abstract public class Response
{
	private transient String rsp;
	private transient Format format;

	public String getResponseString()
	{
		return rsp;
	}

	public void setResponseString(String s)
	{
		this.rsp = s;
	}

	public void setFormat(Format f)
	{
		this.format = f;
	}
	
	public Format getFormat()
	{
		return this.format;
	}

	public String toString()
	{
		return String.valueOf(this.rsp);
	}
	

	static public class SingleContactResponse extends Response
	{
		
		@SerializedName("entry")
		private Contact contact;
		
		
		public SingleContactResponse()
		{
			super();
		}
		
		public Contact getContact()
		{
			return contact;
		}

		public void setContact(Contact c)
		{
			this.contact = c;
		}
	}
	
	static public class MultipleContactResponse extends Response
	{
		private Long startIndex;
		private Long itemsPerPage;
		private Long totalResults;
		private boolean sorted = false;
		private boolean filtered = false;
		
  	    @SerializedName("entry")
		private List<Contact> contacts;
		
		public MultipleContactResponse()
		{
			super();
		}
		
		public List<Contact> getContacts()
		{
			if (contacts == null)
			{
				contacts = new ArrayList<Contact>();
			}
			
			return contacts;
		}
		
		public void addContact(Contact c)
		{
			this.getContacts().add(c);
		}

		public Long getStartIndex()
		{
			return startIndex;
		}

		public void setStartIndex(Long startIndex)
		{
			this.startIndex = startIndex;
		}

		public Long getItemsPerPage()
		{
			return itemsPerPage;
		}

		public void setItemsPerPage(Long itemsPerPage)
		{
			this.itemsPerPage = itemsPerPage;
		}

		public Long getTotalResults()
		{
			return totalResults;
		}

		public void setTotalResults(Long t)
		{
			this.totalResults = t;
		}

		public boolean isSorted()
		{
			return sorted;
		}

		public void setSorted(boolean b)
		{
			this.sorted = b;
		}

		public boolean isFiltered()
		{
			return filtered;
		}

		public void setFiltered(boolean b)
		{
			this.filtered = b;
		}
		
	}
	
}
